package ae.pcfc.cldos.online.web.controller.client.company.ev.termination;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import org.springframework.web.bind.annotation.ModelAttribute;

import ae.pcfc.cldos.online.common.vo.LabelVO;
import ae.pcfc.cldos.online.common.vo.selectors.SystemValuesVO;
import ae.pcfc.cldos.online.web.Constants;
import ae.pcfc.cldos.online.web.controller.base.BasePageController;

/**
 * 
 * @author arosa
 *
 */
public abstract class EVTerminationBase extends BasePageController {

	@ModelAttribute(Constants.__LEAVING_REASON_MODEL_KEY)
	public List<LabelVO> populatePRPeriodList(Locale locale){
		List<LabelVO> labelList = new ArrayList<LabelVO>();
		LabelVO labelVO = new LabelVO();
		
		labelList.add(labelVO);
		
		List<SystemValuesVO> reasons = systemValuesDelegate.getEmployeeLeavingReason();
		
		for(SystemValuesVO reason :reasons ){
			
			labelVO = systemValuesDelegate.getMapper().map(reason, LabelVO.class);
			labelList.add(labelVO);
		}
		
		return labelList;
	}
	
	@ModelAttribute(Constants.__MONTHS_MODEL_KEY)
	public List<LabelVO> populateMonths(Locale locale){
		List<LabelVO> labelList = new ArrayList<LabelVO>();
		LabelVO labelVO = new LabelVO();
		
		labelList.add(labelVO);
		
		List<SystemValuesVO> reasons = systemValuesDelegate.getBanPriod();
		for(SystemValuesVO reason :reasons ){
			
			labelVO = systemValuesDelegate.getMapper().map(reason, LabelVO.class);
			labelList.add(labelVO);
		}
		
		return labelList;
	}
}
